package com.clip.util;


import java.io.BufferedWriter;
import java.io.IOException;
import java.io.StringWriter;

import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;

public class Ftls {
	public static String createTempelt(Object dataModel,String ftlFile) throws IOException, TemplateException{
		Configuration cfg=new Configuration();
		StringWriter stringWriter = new StringWriter();
        BufferedWriter writer = new BufferedWriter(stringWriter);
		String file=ResourceUtils.getString("ftlsPath");
		cfg.setClassForTemplateLoading(Ftls.class, file);
		Template template= cfg.getTemplate(ftlFile);
		template.process(dataModel, writer);
		return stringWriter.toString();
	}
}
